package {
import org.flixel.*;
    // Overall level terrain
    public class SwitchButton extends FlxSprite {
		
		
    
        // Art for Switch
		[Embed(source="switch.png")]
		private var switchSprite:Class;
        
        private var _Id: Number;
        private var _On: Boolean;
    
        public function SwitchButton(X:Number, Y:Number, Id:Number, On:Boolean) {
            // Create sprite at coordinate X, Y
            super(X, Y);
          
            _Id = Id;
            _On = On;
          
			loadGraphic(switchSprite, true, true, 20, 40, true); 
			
			addAnimation("normal", [0]);
			addAnimation("press", [0, 1, 0], 15, false);
			
            //makeGraphic(10, 20, 0xff000000);
        }
        
        public function getId():Number {
            return _Id;
        }
        
        public function toggleOn():void {
            _On = !_On;
                play("press");
        }
        
        public function isOn():Boolean {
            return _On;
        }
        
        override public function update():void {
            
        }
    }
}